#ifndef PAYWINDOW_H
#define PAYWINDOW_H

#include <QJsonDocument>
#include <QJsonObject>
#include <QLineEdit>
#include <QList>
#include <QMainWindow>
#include <QNetworkAccessManager>
#include <QNetworkReply>

namespace Ui {
class PayWindow;
}

class PayWindow : public QMainWindow
{
    Q_OBJECT

public:
    explicit PayWindow(QWidget *parent = nullptr, int x = -1, int y = -1);
    ~PayWindow();
    void ReceivedFromUserOrder(int userId, int orderId); //从个人订单界面接收数据

signals:
    void orderIdReceived(int orderId); // 定义信号，用于传递 orderId

private slots:

    void on_checkBox_Wechat_stateChanged(int arg1);

    void on_checkBox_Ali_stateChanged(int arg1);

    void on_pushButton_toPay_clicked();

    void on_PayWindowInitialized();

    void onGetOrderInfoFinished();

    void onPaymentCompleted(int orderId);

    void onUpdateOrderStatusFinished();

private:
    Ui::PayWindow *ui;
    QNetworkAccessManager *manager; // 声明 QNetworkAccessManager 指针
    int orderId = -1;
    bool orderFound = false; // 用来标记是否找到订单
    int e_userId = -1;
};

#endif // PAYWINDOW_H
